package com.raidan.dclog.core.render.queries;

public class Query implements Cloneable {
	private String description;
	private String sql;
	private String name;
	private boolean system;
	private boolean cycle = false;
	private String cycleColumn;
	private String cycleTemplate;

	public String toString() {
		StringBuilder buffer = new StringBuilder();
		buffer.append(this.name).append(" (");
		buffer.append(system ? "system" : "user").append(", ");
		buffer.append(cycle ? "cycle for '" + cycleTemplate + "'" : "simple").append(", ");
		buffer.append(description);
		buffer.append(")");
		return buffer.toString();
	}

	public String getCycleColumn() {
		return cycleColumn;
	}

	public void setCycleColumn(String cycleColumn) {
		this.cycleColumn = cycleColumn;
	}

	public String getCycleTemplate() {
		return cycleTemplate;
	}

	public void setCycleTemplate(String cycleTemplate) {
		this.cycleTemplate = cycleTemplate;
	}

	public boolean isCycle() {
		return cycle;
	}

	public void setCycle(boolean cycle) {
		this.cycle = cycle;
	}

	public boolean isSystem() {
		return system;
	}

	public void setSystem(boolean system) {
		this.system = system;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getSql() {
		return sql;
	}

	public void setSql(String sql) {
		this.sql = sql;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Query clone() {
		try {
			return (Query) super.clone();
		} catch (CloneNotSupportedException cnse) {
			throw new RuntimeException(cnse);
		}
	}

}
